if(PkgConfig_FOUND)
    pkg_check_modules(opencv QUIET IMPORTED_TARGET opencv4)
    set(packages PkgConfig::opencv)
endif()

if(opencv_FOUND)
    build_all_target(${packages})
else()
    get_filename_component(CURRENT_DIR_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
    message(STATUS "${packages} not found! Skipping ${CURRENT_DIR_NAME}")
endif()
